// pages/authorize/index.js
var app = getApp();
var md5 = require('../../utils/md5.js');
Page({

  /**
   * 页面的初始数据
   */
  data: {
    mone:0,
    moen_system:0,
    moen_reward:0,
    moen_recharge:0
  },
  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (e) {
    var that = this;
    var service = 'User.GetMoneyInfo'
    var user_id = wx.getStorageSync('user_id');
    var open_id = wx.getStorageSync('openid');
    var sign = md5.md5(open_id + service + user_id);
    wx.request({
      url: app.globalData.apiUrl + '?service=' + service,
      header: {
        'Content-Type': 'json'
      },
      data: {
        sign: sign,
        user_id: user_id,
        open_id: open_id
      },
      success: function (res) {
        that.setData({
          mone: res.data.data.info.moen_surplus,
          moen_system: res.data.data.info.moen_system,
          moen_reward: res.data.data.info.moen_reward,
          moen_recharge: res.data.data.info.moen_recharge
        });
      }
    })
  },
  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {
  },
  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {
  },
  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {
  },
  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {
  },
  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {
  },
  onReachBottom: function () {
  },
  rejectLogin: function (e) {
  },
  bindGetUserInfo: function (e) {
  },
  login: function () {
  },
  registerUser: function () {
  },
  walletRed: function () {
    wx.navigateTo({
      url: "/pages/my_wallet_detailed_red/index"
    })
  },
  walletReward: function () {
    wx.navigateTo({
      url: "/pages/my_wallet_detailed_reward/index"
    })
  },
  walletRecharge: function () {
    wx.navigateTo({
      url: "/pages/my_wallet_detailed_recharge/index"
    })
  }
})